﻿using System;
using System.Reflection;
using System.Windows.Media.Imaging;

namespace SBPweb.PlAzureNet.Client.Library
{

    public static class TypeExtenders
    {


        public static BitmapImage GetEmbeddedBitmapImage(this Type extendee, string resourceName)
        {
            Assembly asm = extendee.Assembly;

            string rsName = string.Format("{0}.{1}", asm.FullName.Substring(0, asm.FullName.IndexOf(",") - 3), resourceName);

            BitmapImage bi = new BitmapImage();
            bi.SetSource(asm.GetManifestResourceStream(rsName));
            return bi;
        }


    }

}